Add identity-first attention MLP sweep exploration#663
Open
klei22 wants to merge 1 commit intoReaLLMASIC:masterfrom
Open
Add identity-first attention MLP sweep exploration#663klei22 wants to merge 1 commit intoReaLLMASIC:masterfrom
klei22 wants to merge 1 commit intoReaLLMASIC:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an experimental configuration to evaluate the performance impact of varying MLP sizes in the first transformer block when using identity attention. The goal is to determine whether adding an MLP (or stateless module) provides meaningful improvements during inference, potentially enabling replacement of the word token embedding (wte) and first MLP with a lookup table.
- Adds a YAML configuration sweep for first-layer MLP size variations (512 to 2560)
- Configures a 4-layer transformer with identity attention only in the first block
- Sets up shared hyperparameters across all sweep runs
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The First MLP is Free
This pull request introduces a new experiment configuration file to explore the impact of varying the MLP size in the first transformer block when using identity attention. The configuration sets up a sweep over several first-layer MLP widths, while keeping the rest of the model parameters constant.
While still utilizing shared parameters during training of wte and lm_head, this aims to use a lookup table to replace the wte and the first MLP.
This sweep is intended to scope if adding an MLP (or any module without state) for inference.
Experiment setup and parameter sweep:
explorations/identity_first_layer_mlp_sweep.yamlto define a sweep that varies the first-layer MLP size in a 4-layer transformer, with the first block using identity attention and subsequent blocks using causal attention.512,1024,1536,2048,2560), while keeping other layers at the default size of2048.block_size,n_layer,n_head,n_embd, dataset, device, dtype, and compilation settings.